cmake_minimum_required(VERSION 3.16)


project(Toys VERSION 0.1.241025 LANGUAGES CXX)

configure_file("${CMAKE_CURRENT_LIST_DIR}/res.rc.in" "${CMAKE_CURRENT_LIST_DIR}/res.rc")

set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 6.4 REQUIRED COMPONENTS Quick Svg)

qt_standard_project_setup()

include_directories(${CMAKE_CURRENT_LIST_DIR}/IconTool)

qt_add_executable(appToys
    main.cpp

    res.rc
)

qt_add_qml_module(appToys
    URI Toys
    VERSION 1.0

    SOURCES
    IconTool/icontool.h
    IconTool/icontool.cpp
    IconTool/imageprovider.h
    IconTool/imageprovider.cpp
    app_environment.h

    QML_FILES
    Main.qml
    IconToolView.qml
    Controls/Message.qml
    Controls/Notification.qml
    Controls/Controls.js
)

qt_add_resources(appToys "configuration"
    PREFIX "/"
    FILES
    qtquickcontrols2.conf
    assets/icons/icon_32x32.ico
    assets/icons/icon_64x64.ico
    assets/icons/circle-close-filled.svg
    assets/icons/info-filled.svg
    assets/icons/success-filled.svg
    assets/icons/warning-filled.svg
)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
set_target_properties(appToys PROPERTIES
#    MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appToys
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)

target_link_libraries(appToys
    PRIVATE Qt6::Quick
    Qt6::Svg
)

include(GNUInstallDirs)
install(TARGETS appToys
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
